// pages/detail/detail.js
const util = require('../../utils/util.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    imgUrls: [
      '/static/imgs/adver03.jpg',
      '/static/imgs/adver01.jpg',
      '/static/imgs/adver02.jpg',
    ],
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 1000,
    region:['河南省','洛阳市','涧西区'],
    gid:0,
    goodDetail:{}
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (option) {
    this.setData({
      gid:option.gid
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    this.getGoodDetail();
  },
  getGoodDetail:function(){
    var _this = this;
    wx.request({
      url: util.url.getGoodDetail +"/" + this.data.gid,
      method:"GET",
      success:function(res){
        _this.setData({
          goodDetail:res.data
        })
      }
    })
  }
})